package EazyPrototype;

public class Client {
	
	public static void main(String[] args) {
		try {
			Prototype p1 = new ConcretePrototype1();
			PrototypeManager.setPrototype("p1", p1);
			Prototype p3 = PrototypeManager.getPrototype("p1").clone();
			p3.setName("wzf");
			System.out.println("第一个实例" + p3.toString());
			Prototype p2= new ConcretePrototype2();
			//切换实例
			PrototypeManager.setPrototype("p1", p2);
			Prototype p4 = PrototypeManager.getPrototype("p1").clone();
			p4.setName("李四");
			System.out.println("第二个实例" + p4.toString());
			PrototypeManager.removePrototype("p1");
			Prototype p5 = PrototypeManager.getPrototype("p1").clone();
			p5.setName("王五");
			System.out.println("第三个实例" + p5);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
